package cn.libinal.scloud.base.oauth.service.impl;

import cn.libinal.scloud.base.common.dto.ClientDto;
import cn.libinal.scloud.base.common.dto.PermissionDto;
import cn.libinal.scloud.base.common.dto.RoleDto;
import cn.libinal.scloud.base.common.dto.UserDto;
import cn.libinal.scloud.base.common.web.ResultJson;
import cn.libinal.scloud.base.oauth.service.BaseClients;
import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Set;

/**
 * @author libin
 */
@Slf4j
@Service("baseClientsFallback")
public class BaseClientsFallback implements BaseClients {

    @Override
    public ResultJson<UserDto> findByUsername(String username) {
        log.error("调用{}失败", "findByUsername");
        return ResultJson.error(new UserDto());
    }

    @Override
    public ResultJson<Set<RoleDto>> getRoleByUserId(String userId) {
        log.error("调用{}失败","getRoleByUserId");
        return ResultJson.error(Sets.newHashSet());
    }

    @Override
    public ResultJson<Set<PermissionDto>> getRolePermission(String roleId) {
        log.error("调用{}失败","getRolePermission");
        return ResultJson.error(Sets.newHashSet());
    }

    @Override
    public ResultJson<ClientDto> findClientByClientId(String clientId) {
        log.error("调用{}失败","findClientByClientId");
        return ResultJson.error(new ClientDto());
    }
}
